<?php
$dir = "./1111perfect/";
$i=1;
// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
    if ($dh = opendir($dir)) {
        while (($file = readdir($dh)) !== false) {
            //echo "filename: $file : filetype: " . filetype($dir . $file) . "<br />";
			if(is_dir($file))
			{
				continue;
			}
			else//if($file!='.' && $file!='..')
			{	
				//error_log(print_r($file,true),3,__FILE__.'.log');
				rename($dir.$file,$dir.'data_'.$i.'.sql');
				echo $dir.$file.'被重命名为'.'data_'.$i.'.sql<br />';
				$i++;
			}


        }
        closedir($dh);
    }
}
?> 